package com.hualan.sfzyproject.controller;

import com.hualan.sfzyproject.domain.ConsultationEvaluation;
import com.hualan.sfzyproject.service.ConsultationEvaluationService;
import com.hualan.sfzyproject.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/consultationEvaluation")
public class ConsultationEvaluationController {
    @Autowired
    private ConsultationEvaluationService consultationEvaluationService;

    @PostMapping
    public R insert(@RequestBody ConsultationEvaluation consultationEvaluation) {
        int i = consultationEvaluationService.insert(consultationEvaluation);
        if (i > 0) {
            return R.success("评价成功");
        } else {
            return R.fail("评价失败");
        }
    }

    @DeleteMapping("/{evaluationId}")
    public R delete(@PathVariable("evaluationId") int evaluationId) {
        int i = consultationEvaluationService.delete(evaluationId);
        if (i > 0) {
            return R.success("删除成功");
        } else {
            return R.fail("删除失败");
        }
    }
}
